int treesize(struct TreeNode* root)
{
    if(root == NULL)
    return 0;


    int left= treesize(root->left);
    int right= treesize(root->right);
    return left>right?left+1:right+1;
}
bool isBalanced(struct TreeNode* root) {
    if(root == NULL)
    return true;
    int x=abs(treesize(root->left)-treesize(root->right));
    if(x>1)
    return false;


    return isBalanced(root->left)&&isBalanced(root->right);
}